package ru.p03.tvipuskeditor.client.tvipuskeditor;

import java.sql.Time;
import java.util.ArrayList;
import java.util.List;

import javax.xml.parsers.ParserConfigurationException;
import com.bfr.client.selection.Range;
//import ru.p03.tvipusk.cursortest.TimeHelper;



//import com.google.gwt.xml.client.*;
//import java.text.SimpleDateFormat;
//import java.sql.Time;
//import java.util.ArrayList;
//import java.util.List;

/**
 *
 *  @author cooler
 *  
 */
public class Block {

	private String id = "";
//  private Time s = TimeHelper.zero();
    
//  private Time po = TimeHelper.zero();
	
//  private Time s = new Time(0);
  
//  private Time po = new Time(0);

    private String s = "00:00:00";
    
    private String po = "00:00:00";
	
    private String blockAtrTitle="";
    
    private String blockAtrType="";
    
    private String text="";
    
    private String fileName="";
    
    //private Time duration=TimeHelper.zero();
    //private Time duration = new Time(0);
    private String duration = "";
    
    //Представляет кусок текста (Range) который содержит тег и его атрибуты
    private Range range = null;
    
    private List<Block> blocks=new ArrayList();
    
    //private Element blocksTag;
    
    /**
    * @param args
    * @throws ParserConfigurationException 
    */
//    public static void main(String[] args) throws ParserConfigurationException, ParseException, SAXException, IOException {
//        // TODO Auto-generated method stub
//        SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
//
//        Block block = new Block();
//        List<Block> blocks = new ArrayList<Block>();
//
//        block.setBlockAtrTitle("������� - ������ ���������� ������� �� ��������");
//        block.setBlockAtrType("���");
//        block.setFileName("");
//        block.setS(new Time(format.parse("00:00:00").getTime()));
//        block.setPo(new Time(format.parse("00:00:00").getTime()));
//        block.setText("");
//
//        Block block1 = new Block();
//        block1.setBlockAtrTitle("");
//        block1.setBlockAtrType("���");
//        block1.setText("��� � ���������� ��������� � ���������");
//        block1.setFileName("d001");
//        block1.setDuration(new Time(format.parse("99:99:99").getTime()));
//        block1.setS(new Time(format.parse("00:02:00").getTime()));
//        block1.setPo(new Time(format.parse("00:02:10").getTime()));
//        blocks.add(block1);
//
//        Block block2 = new Block();
//        block2.setBlockAtrTitle("");
//        block2.setBlockAtrType("���");
//        block2.setText("��� ���� ������ ����� ����������, ����� ���� ��������� ���, � ����� ��������, ��� ���������� ������ � ������� �����. ���� �� ��������� ������� �������.");
//        block2.setFileName("d002");
//        block2.setDuration(new Time(format.parse("99:99:99").getTime()));
//        block2.setS(new Time(format.parse("00:01:30").getTime()));
//        block2.setPo(new Time(format.parse("00:01:55").getTime()));
//        blocks.add(block2);
//
//        block.setBlocks(blocks);
//
//        String string = block.toString();
//        System.out.println(string);
//        
//        Block bbb = Block.toBlock(string);
//        System.out.println(bbb.getBlockAtrTitle() + ">>>" + bbb.getBlockAtrType());
//        System.out.println(bbb.getText());
//        System.out.println(bbb.getFileName());
//        System.out.println(bbb.getBlocks().size());
//    }

    public Block() { //throws ParserConfigurationException {
       // TODO Auto-generated constructor stub
        
        
    }
    public Block(String id, String attrType) { 
    	this.id = id;
    	this.blockAtrType = attrType;
    }
    
	/*
	<blocks>
		<block title="..." type="...">
			<text>...</text>
			<file name="..."/>
			<blocks>
				<block title="..." type="...">
					<text>...</text>
					<file name="..."/>
					<blocks/>
				</block>
			</blocks>
		</block>
	</blocks>
	*/
	public String getS() {
		return s;
	}
	public void setS(String s) {
		this.s = s;
	}
	public String getPo() {
		return po;
	}
	public void setPo(String po) {
		this.po = po;
	}
	public List<Block> getBlocks() {
		return blocks;
	}
	public void setBlocks(List<Block> blocks) {
		this.blocks = blocks;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getBlockAtrTitle() {
		return blockAtrTitle;
	}

	public void setBlockAtrTitle(String blockAtrTitle) {
		this.blockAtrTitle = blockAtrTitle;
	}

	public String getBlockAtrType() {
		return blockAtrType;
	}

	public void setBlockAtrType(String blockAtrType) {
		this.blockAtrType = blockAtrType;
	}

    /**
     * @return the duration
     */
    public String getDuration() {
        return duration;
    }

    /**
     * @param duration the duration to set
     */
    public void setDuration(String duration) {
        this.duration = duration;
    }
    
    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id
     */
    public void setId(String id) {
        this.id = id;
    }
	public Range getRange() {
		return range;
	}
	public void setRange(Range range) {
		this.range = range;
	}
    
}
